<?php

namespace App\Http\Controllers\Backend;


use Illuminate\Support\Facades\Config;
use App\Manage\SiteInfoManage;

class SiteInfoController extends BaseController
{
    // 话题
    public function initialize()
    {
        parent::initialize();
    }

    // 父级
    // 添加，修改，删除，列表，停用 操作


    // 获取当前域名
    public function domain()
    {
        $logic  = new SiteInfoManage();
        $domain = $logic->domain();

        return $this->success(['domain' => $domain]);
    }

    // 当前cdn域名
    public function cdn()
    {
        $logic  = new SiteInfoManage();
        $domain = $logic->cdn();

        return $this->success(['domain' => $domain]);
    }

    // 获取配置
    public function lists()
    {
        $options = [];
        $logic   = new SiteInfoManage();
        $list    = $logic->lists($this->myUid, $options);

        return $this->success($list);
    }

    // 内容
    public function content()
    {
        $options = [];
        $logic   = new SiteInfoManage();
        $info    = $logic->content($this->myUid, $options);

        return $this->success($info);
    }

    // 保存
    public function save()
    {
        $options = [];
        $logic   = new SiteInfoManage();
        $res     = $logic->save($this->myUid, $options);
        if($res === false){
            return $this->error($logic->getError());
        }

        return $this->success([], '保存成功！');
    }

}


